<template>
	<view>
		<view>
			<u-empty v-if="cardList.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
			</u-empty>

			<view class="card-list">
				<view class="card-item" v-for="(item, index) in cardList" :key="index" @click="getGoods(item)">
					<!-- 左侧图片 -->
					<view class="card-image">
						<image :src="item.picture" :style="{ width: 100 + 'px', height: 80 + 'px' }" mode="aspectFill">
						</image>
					</view>
					<!-- 右侧文字 -->
					<view class="card-content">
						<view class="card-title">{{ item.shopName }}</view>
						<view>评分:{{ item.shopScore }}</view>
						<view>地址：{{ item.shopAddress }}</view>
						<view class="card-description">{{ item.shopDescription }}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cardList: [],
			}
		},
		onLoad() {
			let that = this;
			that.$ajax(that.$url.searchMyCollectList, "GET", null, function(resp) {
				that.cardList = resp.data.result;
			})
		},
		methods: {
			getGoods(item) {
				console.log(item);
				uni.setStorageSync('shopId', item.id)
				uni.navigateTo({
					url: '../shop_content/shop_content'
				})
			},
		}
	}
</script>

<style>
	.card-list {
		position: absolute;
		margin-top: 20rpx;
		/* display: flex; */
		flex-direction: column;
		padding-bottom: 88rpx;
	}

	.card-item {
		display: flex;
		align-items: center;
		padding: 16px;
	}

	.card-image {
		margin-right: 16px;
	}

	.card-content {
		flex: 1;
	}

	.card-title {
		font-size: 18px;
		font-weight: bold;
		margin-bottom: 8px;
	}

	.card-description {
		font-size: 14px;
		color: #666;
	}
</style>